package com.bonc.rms.dao.impl;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.bonc.rms.dao.QueryDao;
import com.bonc.rms.utils.IESSearchUtil;
import com.bonc.rms.utils.impl.ESSearchUtilImpl;

@Repository
public class QueryDaoImpl extends BaseDaoImpl implements QueryDao {

	@Override
	public List<Map<String, Object>> detailQuery(List<String> queryList, int pageNo) {
		IESSearchUtil iesSearchUtil = new ESSearchUtilImpl();
		List<Map<String, Object>> resultList = iesSearchUtil.getPageListByList(queryList, 10, pageNo);
		resultList.get(resultList.size() - 1).put("pageIndex", pageNo);
		resultList.get(resultList.size() - 1).put("prepageCount", 10);
		return resultList;
	}

	@Override
	public List<Map<String, Object>> seniorQuery(Map<String, Object> dataMap, int pageNo) {
		IESSearchUtil iesSearchUtil = new ESSearchUtilImpl();
		List<Map<String, Object>> resultList = iesSearchUtil.getPageListByMap(dataMap, 10, pageNo);
		resultList.get(resultList.size() - 1).put("pageIndex", pageNo);
		resultList.get(resultList.size() - 1).put("prepageCount", 10);
		return resultList;
	}

	@Override
	public List<Map<String, Object>> seniorQuery(String string, String string2, int pageNo) {
		IESSearchUtil iesSearchUtil = new ESSearchUtilImpl();
		List<Map<String, Object>> resultList = iesSearchUtil.getPageListByKeyword("_all", "", 10, pageNo);
		resultList.get(resultList.size() - 1).put("pageIndex", pageNo);
		resultList.get(resultList.size() - 1).put("prepageCount", 10);
		return resultList;
	}

}
